<template>
  <div id="bring_goods">
    <div class="rightBox">
      <div class="btn_group">
        <button :class="{ active: input_btn == '直播带货榜' }" @click="input_btn = '直播带货榜'">直播带货榜</button>
        <button :class="{ active: input_btn == '直播小时榜' }" @click="input_btn = '直播小时榜'">直播小时榜</button>

        <button :class="{ active: input_btn == '直播人气榜' }" @click="input_btn = '直播人气榜'">直播人气榜</button>
      </div>
      <div class="rightBox-content">
        <liveHoursRank v-if="input_btn == '直播小时榜'" />
        <BringGoods01 v-if="input_btn == '直播带货榜'" />
        <livePopularity v-if="input_btn == '直播人气榜'" />
      </div>
    </div>
  </div>
</template>
<script>
import BringGoods01 from './bring_goods01.vue';
import liveHoursRank from './liveHoursRank.vue';
import livePopularity from './livePopularity.vue';

export default {
  name: 'bring_goods',
  components: { BringGoods01, liveHoursRank, livePopularity },
  data() {
    return {
      input_btn: '直播带货榜'
    };
  },
  computed: {},
  watch: {
    input_btn: function (newVal, oldVal) {
      if (newVal == '直播小时榜') {
        this.input_btn = '直播小时榜';
        document.title = '直播小时榜-直播电商数据分析&智能分析服务平台-掌上精选';
      } else if ((newVal = '直播带货榜')) {
        this.input_btn == '直播带货榜';
        document.title = '直播带货榜-直播电商数据分析&智能分析服务平台-掌上精选';
      } else if ((newVal = '直播人气榜')) {
        this.input_btn == '直播人气榜';
        document.title = '直播人气榜-直播电商数据分析&智能分析服务平台-掌上精选';
      }
    }
  },
  created() {
    document.title = '直播带货榜-直播电商数据分析&智能分析服务平台-掌上精选';
    if (this.$route.params.id) {
      this.input_btn = this.$route.params.id;
    }
  },
  mounted() {
    this.showtabs();
  },
  methods: {
    showtabs() {
      if (this.$route.query.input_btn != null) {
        this.input_btn = this.$route.query.input_btn;
      }
    }
  }
};
</script>
<style scoped lang='less'>
#bring_goods {
  box-sizing: border-box;
  display: flex;
  min-height: 80vh;

  margin-top: @margin-num;
  margin-left: @margin-num;
  margin-right: @margin-num;
  background-color: #f1f1f1;

  .rightBox {
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
    height: 100%;
    -webkit-box-flex: 1;
    -ms-flex: 1;
    flex: 1;
    border-radius: 6px;
    .btn_group {
      .active {
        background-color: #fd7f2c;
        color: #ffffff !important;
      }
      button {
        font-size: 14px;
        color: #555;
        padding-left: 23px;
        padding-right: 23px;
        height: 40px;
        background-color: #fff;
        border-radius: 4px;
        margin-right: 7px;
        font-weight: 600;
      }
      button:hover {
        color: #ff924b;
      }
    }
  }
  .rightBox-content {
    background-color: #ffffff;
    border-radius: 6px;
    margin-top: 10px;
  }
}
</style>
